#ifndef __BMP_H
#define __BMP_H

#include <stdio.h>

//#ifndef _WINDOWS_
//#ifndef _WINGDI_


typedef unsigned long       DWORD;
typedef int                 BOOL;
typedef unsigned char       BYTE;
typedef unsigned short      WORD;
typedef long				LONG;


struct GFX_RGBQUAD
{
  unsigned char    rgbBlue;
  unsigned char    rgbGreen;
  unsigned char    rgbRed;
  unsigned char    rgbReserved;
};

struct GFX_BITMAPFILEHEADER
{
  unsigned short    bfType; 
  unsigned long		bfSize;
  unsigned short    bfReserved1;
  unsigned short    bfReserved2;
  unsigned long		bfOffBits;
};
// make sure compiler does not assign 16 bytes instead of 14
#define HACKED_GFX_BITMAPFILEHEADER_SIZE 14

struct GFX_BITMAPINFOHEADER
{
  unsigned long		biSize; 
  long				biWidth;
  long				biHeight;
  unsigned short	biPlanes;
  unsigned short	biBitCount;
  unsigned long		biCompression;
  unsigned long		biSizeImage;
  long				biXPelsPerMeter;
  long				biYPelsPerMeter;
  unsigned long		biClrUsed; 
  unsigned long		biClrImportant;
};

#define BI_RGB        0L
#define BI_RLE8       1L
#define BI_RLE4       2L
#define BI_BITFIELDS  3L

//#endif

//#else

//#include <afxwin.h>
//#include <wingdi.h>

//#endif

int ReadHeader(FILE *infile, GFX_BITMAPINFOHEADER *i);
int WriteHeader(GFX_BITMAPINFOHEADER *i, FILE *outfile);

typedef struct
{
	GFX_BITMAPINFOHEADER info;
	GFX_RGBQUAD color[256];
} GFX_BITMAPINFOHEADERWPALETTE;

typedef struct
{
  BYTE rgbBlue;
  BYTE rgbGreen;
  BYTE rgbRed;
} RGB;


#endif